<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	template="/WEB-INF/layout/t.xhtml">

	<ui:define name="title">
		<h:outputText value="Lista Esposizioni" />
	</ui:define>
	<ui:define name="roles">
		<f:attribute name="roles" value="exhibition" />
	</ui:define>
	<ui:define name="content">
		<h:form>
			<center>
				<p:panel header="Lista Esposizioni">
					<h:panelGrid columns="7">
						<h:outputLabel for="name" value="Nome:" />
						<h:inputText id="name"
							value="#{exhibitionController.search.obj.name}" />

						<h:outputLabel for="year" value="Anno:" />
						<h:inputText id="year"
							value="#{exhibitionController.search.obj.year}" />
						<h:commandButton action="#{exhibitionController.reloadAjax}"
							value="Cerca" />
					</h:panelGrid>
					<br />

					<p:dataTable id="exhibitionList" rowIndexVar="rowIndex"
						var="exhibition" value="#{exhibitionController.model}"
						rows="#{exhibitionController.pageSize}" paginator="true"
						dynamic="true">
						<p:column width="50">
							<h:outputText value="#{rowIndex+1}" />
						</p:column>

						<p:column width="300">
							<f:facet name="header">nome</f:facet>
							<h:outputText value="#{exhibition.name}" />
						</p:column>

						<p:column width="300">
							<f:facet name="header">anteprima</f:facet>
							<h:outputText value="#{exhibition.preview}" />
						</p:column>

						<p:column width="300">
							<f:facet name="header">anno</f:facet>
							<h:outputText value="#{exhibition.year}" />
						</p:column>

						<p:column width="300">
							<f:facet name="header">data</f:facet>
							<h:outputText value="#{exhibition.date}" />
						</p:column>


						<p:column width="100">
							<f:facet name="header">operazioni</f:facet>
							<center>
								<h:commandLink action="#{exhibitionController.viewElement}"
									value="vedi" />
								<br />
								<h:commandLink action="#{exhibitionController.modElement}"
									value="modifica testi" />
								<br />
								<h:commandLink action="#{exhibitionController.modImage}"
									value="modifica immagini" />
							</center>
						</p:column>
					</p:dataTable>
				</p:panel>
				<br /> <br />

				<h:panelGrid columns="1">
					<h:commandButton id="add"
						action="#{exhibitionController.addElement}" value="Aggiungi" />
				</h:panelGrid>
			</center>
		</h:form>
	</ui:define>
</ui:composition>